home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / ctask.zip / TSKLOCAL.H < prev    next >
C/C++ Source or Header  |  1988-07-01  |  3KB  |  104 lines

  1. /*
  2.    TSKLOCAL.H - CTask - Internal definitions and prototypes.
  3.  
  4.    Public Domain Software written by
  5.       Thomas Wagner
  6.       Patschkauer Weg 31
  7.       D-1000 Berlin 33
  8.       West Germany
  9. */
  10.  
  11. /*
  12.    struct task_stack describes the contents of a tasks stack after creation.
  13.    The first 10 words are the registers to be restored by the scheduler.
  14.    Only the segment registers are significant initially.
  15.    The next three words contain the function address plus the CPU flags
  16.    setup as if an interrupt had occurred at the function's entry address.
  17.  
  18.    This setup is the same as the stack of an interrupted task after
  19.    scheduling.
  20.  
  21.    The following two words contain a dummy return address, which points
  22.    to the routine "killretn". Thus, if the task main function should ever
  23.    return, the task is automatically killed. The last doubleword is
  24.    used for the optional argument to the task.
  25. */
  26.  
  27. struct task_stack {
  28.                   word     r_es;
  29.                   word     r_ds;
  30.                   word     r_di;
  31.                   word     r_si;
  32.                   word     r_bp;
  33.                   word     r_sp;
  34.                   word     r_bx;
  35.                   word     r_dx;
  36.                   word     r_cx;
  37.                   word     r_ax;
  38.                   funcptr  retn;
  39.                   word     r_flags;
  40.                   funcptr  dummyret;
  41.                   farptr   arg;
  42.                   };
  43.  
  44. extern tcbptr     _Near tsk_eligible;
  45. extern tcbptr     _Near tsk_current;
  46. extern tlinkptr   _Near tsk_timer;
  47. extern byte       _Near tsk_preempt;
  48. extern byte       _Near tsk_pretick;
  49.  
  50. #if (CLOCK_MSEC)
  51. extern dword tsk_timeout (dword tout);
  52. extern double tick_factor;
  53. #else
  54. #define tsk_timeout(tout)  tout
  55. #endif
  56.  
  57. extern void far tsk_enqueue (tcbptr task, tqueptr que);
  58. extern void far tsk_unqueue (tcbptr task);
  59. extern void far tsk_enqtimer (tcbptr task, dword tout);
  60. extern void far tsk_unqtimer (tcbptr task);
  61.  
  62. extern void far tsk_kill (tcbptr task);
  63. extern void far tsk_kill_queue (tqueptr que);
  64.  
  65. extern void far tsk_install_timer (word divisor, word sys_ticks);
  66. extern void far tsk_remove_timer (void);
  67. extern void far tsk_install_dos (void);
  68. extern void far tsk_remove_dos (void);
  69. extern void far tsk_install_kbd (void);
  70. extern void far tsk_remove_kbd (void);
  71. extern void far tsk_chain_timer (void);
  72.  
  73. extern void far tsk_install_bios (void);
  74. extern void far tsk_remove_bios (void);
  75.  
  76. #if (TURBO)
  77. #define tsk_dseg()   _DS
  78. #else
  79. extern word far tsk_dseg (void);
  80. #endif
  81.  
  82. extern word far tsk_flags (void);
  83.  
  84. extern tcbptr far tsk_runable (tcbptr task);
  85. extern void far tsk_wakeup (tcbptr task);
  86. extern void far tsk_wait (tqueptr que, dword timeout);
  87.  
  88.  
  89. /*
  90.    tsk_unqtimer 
  91.       Marks a task for removal from the timer queue. 
  92. */
  93.  
  94. #define tsk_unqtimer(task) { if (task->timerq.tstate != TSTAT_IDLE) \
  95.                                 task->timerq.tstate = (byte) TSTAT_REMOVE; }
  96.  
  97. #if (TSK_NAMED)
  98. extern namerec tsk_name_list;
  99. extern void far tsk_add_name (nameptr elem, byteptr name, byte kind, 
  100.                               farptr strucp);
  101. extern void far tsk_del_name (nameptr elem);
  102. #endif
  103.  
  104.